<?php 
if (!defined("MCTDESIGN")) die("# ");

global $anyDB,$temp,$dir_tpl,$shopurl;
echo $base_tpl;
     $id_galery = isset($_GET["catid"]) ? m_htmlchars(stripslashes(urldecode($_GET["catid"]))) : "";   
    if(!empty($id_galery)){
// lay 9 cai dai dien
        $sql = "select imag_name,imag_url,imag_description from  ".$tb_fix."_galery_images where gale_id =$id_galery   ORDER BY RAND( ) LIMIT 9";
        $q = $anyDB->query($sql);
        $arr = $anyDB->getAll($q);
        $temp->assign('hinhanhsl',$arr);
// lay toan bo lam linhk an
        $sql1 = "select imag_name,imag_url,imag_description from  ".$tb_fix."_galery_images where gale_id =$id_galery  ";
        $q1 = $anyDB->query($sql1);
        $arr1 = $anyDB->getAll($q1);
        $temp->assign('hinhanhnhieu',$arr1);
// get title ambun
        $sql2 = "select gale_name from ".$tb_fix."_galery where gale_id =$id_galery";
        $q2 = $anyDB->query($sql2);
        $arr2 = $anyDB->getNext($q2);
        $temp->assign('title',$arr2['gale_name']);  
// get bo suu tap lien quan
        $sql3 = "select gale_name,gale_id,gale_description from ".$tb_fix."_galery where gale_id != $id_galery ORDER BY RAND( ) LIMIT 9 ";
        $query3 = $anyDB->query($sql3);
        $arr3 = $anyDB->getAll($query3);
        foreach ($arr3 as $key => $value){
            $arr3[$key]['title_conver'] = convertText($value['gale_name']); 
        }
        $temp->assign('galery_lienquan',$arr3);        
              
        $temp->assign( 'base_tpl', "".$dir_tpl."" );
        $temp->assign( 'shopurl', "".$shopurl."" );
        $content =$temp->fetch( 'modules/_galery.mct' );   
    }else{
    header("Location: home.html");
}